From b99f06827522ab8149eaa6f0c4d595b9ccdd8dd2 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sat, 19 Mar 2022 12:38:38 -0600 Subject: [PATCH] use static const QRegularExpressions in GUI. --- gui/formatload.cc | 5 +++-- gui/help.cc | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gui/formatload.cc b/gui/formatload.cc index 9f39df6c5..7f414846b 100644 --- a/gui/formatload.cc +++ b/gui/formatload.cc @@ -52,7 +52,7 @@ static QString xlt(const QString& f) //------------------------------------------------------------------------ bool FormatLoad::skipToValidLine() { - QRegularExpression regex("^file|serial"); + static const QRegularExpression regex("^file|serial"); while ((currentLine_ < lines_.size()) && !regex.match(lines_[currentLine_]).hasMatch()) { currentLine_++; } @@ -127,7 +127,8 @@ bool FormatLoad::processFormat(Format& format) #ifndef GENERATE_CORE_STRINGS if (htmlPage.length() > 0 && Format::getHtmlBase().length() == 0) { QString base = htmlPage; - base.replace(QRegularExpression("/[^/]+$"), "/"); + static const QRegularExpression re("/[^/]+$"); + base.replace(re, "/"); Format::setHtmlBase(base); } #endif diff --git a/gui/help.cc b/gui/help.cc index bf05187d0..cc169d735 100644 --- a/gui/help.cc +++ b/gui/help.cc @@ -34,7 +34,8 @@ void ShowHelp(const QString& urlIn) { QString url = urlIn; - if (!url.contains(QRegularExpression(R"(^https?://)"))) { + static const QRegularExpression re(R"(^https?://)"); + if (!url.contains(re)) { url = Format::getHtmlBase() + url; } QDesktopServices::openUrl(QUrl(url)); -- 2.30.2